package com.lg.patter.behavior.observed;

import java.util.Observable;

/**
 * 继承 Observable 就可以呗观察了
 *
 * @author by Mr. Li 2020/5/8 19:15
 */
public class Course extends Observable {
    private String courseName;

    public Course(String courseName) {
        this.courseName = courseName;
    }

    public String getCourseName() {
        return courseName;
    }

    public void produceQuestion(Course course, Question question) {
        System.out.println(course.courseName);
        setChanged();// 改变状态
        notifyObservers(question);
    }
}
